home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 August / Australian PC User - August 2003 (CD2).iso / tutorial / macromed / files / dreamwv / datetime_files / globalnav.js < prev    next >
Encoding:
JavaScript  |  2003-06-05  |  1.6 KB  |  56 lines

  1. /* 
  2.     Copyright (c) 2002-2003 Macromedia, Inc. 
  3.     globalnav scripts    
  4.     Language: JavaScript 1.2
  5.     
  6.     $Revision: 1.20 $
  7.     
  8. */
  9.  
  10. // called by globalnav.swf 
  11. // sets the mediapref cookie
  12. function setFlash(flash_version_string) {
  13.     var pixelName = 'flash_pixel';
  14.     if (document[pixelName] && flash_version_string) {
  15.         document[pixelName].src = '/set_media_pref?'+flash_version_string;
  16.     }
  17. }
  18. function defineFunctions() {
  19.     if (!document.getElementById) {
  20.         if (document.layers) document.getElementById = function(str) { return document.layers[str]; }
  21.         if (document.all) document.getElementById = function(str) { return document.all[str]; }
  22.     }
  23. }
  24. function positionContent(y) {
  25.     var contentBox = document.getElementById('contentWrapper');
  26.     if (y && contentBox) {    
  27.         contentBox.style.top = y + 'px';
  28.     }
  29. }
  30. function calcGlobalnavHeight() {
  31.     var globalmessage = document.getElementById('globalmessage');
  32.     var gma_height = ((globalmessage != null) && (typeof(globalmessage) == 'object')) ? globalmessage.height : 0;
  33.     var height = 64 + gma_height + 8;
  34.     return height;
  35. }
  36. //
  37. //
  38. function setSWFHeight(h) {
  39.     if (document.getElementById('globalnav-object') != null) {
  40.         document.getElementById('globalnav-object').setAttribute('height',h);
  41.     }    
  42.     if (document.getElementById('globalnav-embed') != null) {
  43.         document.getElementById('globalnav-embed').setAttribute('height',h);
  44.     }
  45. }
  46. //
  47. function initPage() {
  48.     defineFunctions();    
  49.     if (!document.getElementById('globalnav-object') &&
  50.             !document.getElementById('globalnav-embed') &&
  51.             !document.getElementById('globalnav-primary') && 
  52.             !document.getElementById('global-message')) {    
  53.         positionContent(calcGlobalnavHeight());
  54.     }
  55. }
  56.